import { defineConfig } from "vite";
import uni from "@dcloudio/vite-plugin-uni";
import AutoImport from 'unplugin-auto-import/vite'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [uni(),
  //自动导入配置
  AutoImport({
	  imports:[
		  //预设
		  'vue',
		  'uni-app'
	  ]
  })
  ],
  server: {
        // 允许IP访问
        host: "0.0.0.0",
        // 应用端口 (默认:3000)
        proxy: {
          /** 代理前缀为 /api 的请求  */
          '/api': {
            // 接口地址 
            target: "http://localhost:8081",
  			changeOrigin: true,
            rewrite: (path)=>path.replace(/^\/api/,'')
          },
        },
      },
});
